package com.example.rwq_test.designParttern.multiThread.future;

import java.io.File;
import java.util.concurrent.TimeUnit;

/**
 * future模式
 *
 * @author renweiqiang
 * @version 1.0.0
 * @createTime 2022/11/15
 */
public class Main {
    public static void main(String[] args) {
        String url = "http://api.elevatorcontrol.starspeed.store";
        System.out.println(url.substring(0, url.lastIndexOf(File.separator)));
        System.out.println("main BEGIN");
        Host host = new Host();
        Data data1 = host.request(10, 'A');
        Data data2 = host.request(20, 'B');
        Data data3 = host.request(30, 'C');
        Data data4 = host.request(40, 'D');

        System.out.println("main otherJob BEGIN");
        try {
            TimeUnit.MILLISECONDS.sleep(2000);
        } catch (InterruptedException e) {
        }

        System.out.println("data1 = " + data1.getContent());
        System.out.println("data2 = " + data2.getContent());
        System.out.println("data3 = " + data3.getContent());
        System.out.println("data4 = " + data4.getContent());
        System.out.println("main END");
    }
}
